cmake_minimum_required(VERSION 2.8)

# 交叉编译时指定gcc版本
#SET(CMAKE_C_COMPILER "/usr/bin/aarch64-linux-gnu-gcc")
#SET(CMAKE_CXX_COMPILER "/usr/bin/aarch64-linux-gnu-g++")

project(v4l2)

# Compile options(编译选项)
#add_compile_options(-std=c++11)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -g -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -O2 -Wall")

# 头文件路径
include_directories(
    ${CMAKE_SOURCE_DIR}/inc
    ${CMAKE_SOURCE_DIR}/Framebuffer
    ${CMAKE_SOURCE_DIR}/tcp_server
    ${CMAKE_SOURCE_DIR}/video
)

# 链接动态库
link_directories(
    # ${CMAKE_SOURCE_DIR}/lib
)

# aux_source_directory(${CMAKE_SOURCE_DIR}/src cpp)
add_executable(main ${cpp})
target_sources(main PRIVATE
    src/main.cpp
    Framebuffer/Framebuffer.cpp
    tcp_server/tcp_server.cpp
    video/v4l2.cpp
    video/video.cpp
)

find_package(OpenCV REQUIRED)
target_link_libraries(main 
    ${OpenCV_LIBS}
    pthread
)